package demo5;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Component
public class Person {
    /*
    * 可以根据name参数指定的类名装配spring管理的一个类
    * 注意:类名这里首字母要小写
    * @Resource(name = "sweater")   装配Sweater类的实例
    * @Resource(name = "shirt")     装配Shirt类的实例
    * */
    @Resource
    private Clothes shirt;

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + shirt +
                '}';
    }
}
